package com.memorywords.mapper;

import com.github.pagehelper.Page;
import com.memorywords.pojo.Word;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LikeMapper {

    @Select("select count(*) from user_like where user_id=#{userId} and word_id=#{wordId}")
    boolean check(int userId, int wordId);

    @Insert("insert into user_like (user_id, word_id) values (#{userId}, #{wordId})")
    void add(int userId, int wordId);

    @Delete("delete from user_like where user_id=#{userId} and word_id=#{wordId}")
    void del(int userId, int wordId);

    Page<Word> getList(int userId, int pageNum, int pageSize);
}
